<?php
session_start();
require_once('db.php');
$valor = $_POST['option'];
$follower = $_SESSION['auth'];
$followee = $_POST['followee'];

/**
    <follow>
        <opt>follow</opt>
        <user>danigm</user>
    </follow>
**/
if($valor == "follow this"){
    $dev = '<follow><opt>follow</opt><user>'.$follower.'</user></follow>';
    $q = sprintf("insert into followers (follower, followee) values ('%s', '%s')",
    mysql_real_escape_string($follower), mysql_real_escape_string($followee));
$res = mysql_query($q);

}
else{
    $dev = '<follow><opt>not follow</opt><user>'.$follower.'</user></follow>';
    $q = sprintf("delete from followers where follower='%s' and followee='%s'",
        mysql_real_escape_string($follower), mysql_real_escape_string($followee));
    $res = mysql_query($q);
}

print $dev;
?>
